local lanhui = fk.CreateSkill{
  name = "investiture__lanhui",
}

Fk:loadTranslationTable{
  ["investiture__lanhui"] = "揽贿",
  [":investiture__lanhui"] = "出牌阶段限一次，你可以移动场上的一张牌，然后若因此失去场上的牌的角色："
  .."为你，你摸两张牌；不为你，其可以视为对你使用一张【兵临城下】。",
  ["#investiture__lanhui"] = "揽贿：你可以移动场上的一张牌<br />若移动你的牌，你摸牌<br />"
  .."若移动其他角色的牌，其可以视为对你使用【兵临城下】",

  ["#investiture__lanhui-use"] = "揽贿：可以对 %dest 视为使用【兵临城下】",

  ["$investiture__lanhui1"] = "逢君欲作千年调，买窟惟知百计要。",
  ["$investiture__lanhui2"] = "奉命督工人力尽，剥民膏髓自肥饶~",
}

lanhui:addEffect("active", {
  anim_type = "drawcard",
  prompt = "#investiture__lanhui",
  card_num = 0,
  target_num = 2,
  can_use = function (self, player)
    return player:usedSkillTimes(lanhui.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function (self, player, to_select, selected)
    if #selected == 0 then
      return #to_select:getCardIds("ej") > 0
    elseif #selected == 1 then
      return selected[1]:canMoveCardsInBoardTo(to_select)
    else
      return false
    end
  end,
  on_use = function (self, room, effect)
    local player = effect.from
    local tos = effect.tos

    local move = room:askToMoveCardInBoard(player, {
      target_one = tos[1],
      target_two = tos[2],
      skill_name = lanhui.name,
    })

    if player.dead or not move then return end
    if move.from == player then
      player:drawCards(2, lanhui.name)
    else
      local card = Fk:cloneCard("enemy_at_the_gates")
      card.skillName = lanhui.name
      if move.from:canUseTo(card, player)
      and room:askToSkillInvoke(move.from, { skill_name = lanhui.name, prompt = "#investiture__lanhui-use::"..player.id }) then
        room:useCard{
          card = card,
          from = move.from,
          tos = { player },
        }
      end
    end
  end
})

return lanhui